package thread;

import java.time.LocalDateTime;


public class DaemonThread {
    public static void main(String[] args) {
        Thread thread = new Thread(new MyThread());
        thread.setDaemon(true);
        thread.start();
        for (int i = 0; i < 100; i++) {
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println(i);
        }
    }
}
class MyThread implements Runnable{
    @Override
    public void run() {
        while (true){
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println(LocalDateTime.now());
        }
    }
}
